From: Dan Dennedy Date: Thu, 18 Dec 2025 11:30:00 +0000 (+0100) Subject: Fix configuring with CMake version 4 X-Git-Tag: archive/raspbian/4.10.0+dfsg-7+rpi1^2~3 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/%22/%22http:/www.example.com/cgi/%22?a=commitdiff_plain;h=927ddde64b1d25c72c275dec9a8e27d487490cf5;p=opencv.git Fix configuring with CMake version 4 Origin: upstream, https://github.com/opencv/opencv/commit/cb8030809e0278d02fa335cc1f5ec7c3c17548e0 Bug-Debian: https://bugs.debian.org/1113355 Last-Update: 2025-04-02 Gbp-Pq: Name cmake-4.patch --- diff --git a/CMakeLists.txt b/CMakeLists.txt index f5e39b4..5ca6f7f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -16,7 +16,7 @@ endif() include(cmake/OpenCVMinDepVersions.cmake) if(CMAKE_SYSTEM_NAME MATCHES WindowsPhone OR CMAKE_SYSTEM_NAME MATCHES WindowsStore) - cmake_minimum_required(VERSION 3.1 FATAL_ERROR) + cmake_minimum_required(VERSION 3.5 FATAL_ERROR) #Required to resolve linker error issues due to incompatibility with CMake v3.0+ policies. #CMake fails to find _fseeko() which leads to subsequent linker error. #See details here: http://www.cmake.org/Wiki/CMake/Policies diff --git a/cmake/OpenCVGenPkgconfig.cmake b/cmake/OpenCVGenPkgconfig.cmake index 4fc80f5..3532260 100644 --- a/cmake/OpenCVGenPkgconfig.cmake +++ b/cmake/OpenCVGenPkgconfig.cmake @@ -110,7 +110,7 @@ endif() # ============================================================================= else() # DEFINED CMAKE_HELPER_SCRIPT -cmake_minimum_required(VERSION 2.8.12.2) +cmake_minimum_required(VERSION 3.5) cmake_policy(SET CMP0012 NEW) include("${CMAKE_HELPER_SCRIPT}") include("${OpenCV_SOURCE_DIR}/cmake/OpenCVUtils.cmake") diff --git a/doc/tutorials/introduction/linux_gcc_cmake/linux_gcc_cmake.markdown b/doc/tutorials/introduction/linux_gcc_cmake/linux_gcc_cmake.markdown index d08280d..01d2d69 100644 --- a/doc/tutorials/introduction/linux_gcc_cmake/linux_gcc_cmake.markdown +++ b/doc/tutorials/introduction/linux_gcc_cmake/linux_gcc_cmake.markdown @@ -61,7 +61,7 @@ int main(int argc, char** argv ) Now you have to create your CMakeLists.txt file. It should look like this: @code{.cmake} -cmake_minimum_required(VERSION 2.8) +cmake_minimum_required(VERSION 3.5) project( DisplayImage ) find_package( OpenCV REQUIRED ) include_directories( ${OpenCV_INCLUDE_DIRS} ) diff --git a/modules/python/CMakeLists.txt b/modules/python/CMakeLists.txt index 93eab8c..ec30f42 100644 --- a/modules/python/CMakeLists.txt +++ b/modules/python/CMakeLists.txt @@ -35,7 +35,7 @@ add_subdirectory(python3) else() # standalone build -cmake_minimum_required(VERSION 2.8.12.2) +cmake_minimum_required(VERSION 3.5) project(OpenCVPython CXX C) include("./standalone.cmake") diff --git a/platforms/android/build-tests/test_cmake_build.py b/platforms/android/build-tests/test_cmake_build.py index 25d185b..51affd1 100644 --- a/platforms/android/build-tests/test_cmake_build.py +++ b/platforms/android/build-tests/test_cmake_build.py @@ -7,7 +7,7 @@ import logging as log log.basicConfig(format='%(message)s', level=log.DEBUG) CMAKE_TEMPLATE='''\ -CMAKE_MINIMUM_REQUIRED(VERSION 2.8) +CMAKE_MINIMUM_REQUIRED(VERSION 3.5) # Enable C++11 set(CMAKE_CXX_STANDARD 11) diff --git a/samples/CMakeLists.example.in b/samples/CMakeLists.example.in index 7cf20d5..59a133b 100644 --- a/samples/CMakeLists.example.in +++ b/samples/CMakeLists.example.in @@ -1,5 +1,5 @@ # cmake needs this line -cmake_minimum_required(VERSION 3.1) +cmake_minimum_required(VERSION 3.5) if(NOT DEFINED EXAMPLE_NAME) message(FATAL_ERROR "Invalid build script: missing EXAMPLE_NAME") diff --git a/samples/CMakeLists.txt b/samples/CMakeLists.txt index 6a18b61..dabe077 100644 --- a/samples/CMakeLists.txt +++ b/samples/CMakeLists.txt @@ -62,7 +62,7 @@ else() # Standalone mode # #=================================================================================================== -cmake_minimum_required(VERSION 3.1) +cmake_minimum_required(VERSION 3.5) project(samples C CXX) option(BUILD_EXAMPLES "Build samples" ON) diff --git a/samples/cpp/example_cmake/CMakeLists.txt b/samples/cpp/example_cmake/CMakeLists.txt index 8d5cd98..f17aca4 100644 --- a/samples/cpp/example_cmake/CMakeLists.txt +++ b/samples/cpp/example_cmake/CMakeLists.txt @@ -1,5 +1,5 @@ # cmake needs this line -cmake_minimum_required(VERSION 3.1) +cmake_minimum_required(VERSION 3.5) # Define project name project(opencv_example_project) diff --git a/samples/cpp/tutorial_code/gpu/gpu-thrust-interop/CMakeLists.txt b/samples/cpp/tutorial_code/gpu/gpu-thrust-interop/CMakeLists.txt index 037d508..1a35085 100644 --- a/samples/cpp/tutorial_code/gpu/gpu-thrust-interop/CMakeLists.txt +++ b/samples/cpp/tutorial_code/gpu/gpu-thrust-interop/CMakeLists.txt @@ -1,4 +1,4 @@ -CMAKE_MINIMUM_REQUIRED(VERSION 2.8) +CMAKE_MINIMUM_REQUIRED(VERSION 3.5) FIND_PACKAGE(CUDA REQUIRED) INCLUDE_DIRECTORIES(${CUDA_INCLUDE_DIRS}) diff --git a/samples/hal/c_hal/CMakeLists.txt b/samples/hal/c_hal/CMakeLists.txt index 8cf78aa..72dfef0 100644 --- a/samples/hal/c_hal/CMakeLists.txt +++ b/samples/hal/c_hal/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 2.8.12.2 FATAL_ERROR) +cmake_minimum_required(VERSION 3.5 FATAL_ERROR) set(PROJECT_NAME "c_hal") set(HAL_LIB_NAME "c_hal") diff --git a/samples/hal/slow_hal/CMakeLists.txt b/samples/hal/slow_hal/CMakeLists.txt index 1ffa467..a20596e 100644 --- a/samples/hal/slow_hal/CMakeLists.txt +++ b/samples/hal/slow_hal/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 2.8.12.2 FATAL_ERROR) +cmake_minimum_required(VERSION 3.5 FATAL_ERROR) set(PROJECT_NAME "slow_hal") set(HAL_LIB_NAME "slow_hal") diff --git a/samples/openvx/CMakeLists.txt b/samples/openvx/CMakeLists.txt index fd04e6b..c5efdf9 100644 --- a/samples/openvx/CMakeLists.txt +++ b/samples/openvx/CMakeLists.txt @@ -1,6 +1,6 @@ ocv_install_example_src(cpp *.cpp *.hpp CMakeLists.txt) -cmake_minimum_required(VERSION 2.8.12.2) +cmake_minimum_required(VERSION 3.5) set(OPENCV_OPENVX_SAMPLE_REQUIRED_DEPS opencv_core